import pandas as pd
from sqlalchemy import create_engine

engine = create_engine(
    'mysql+pymysql://root:123456@127.0.0.1:3306/test?charset=utf8')
sql = pd.read_sql('changed_gzdata', engine, chunksize=10000)

for i in sql:  # 逐块变换并去重
    d = i.copy()
    d['type_1'] = d['fullURL']  # 复制一列
    # 将含有ask、askzt关键字的网址的类别一归为咨询（后面的规则就不详细列出来了，实际问题自己添加即可）
    d['type_1'][d['fullURL'].str.contains('(ask)|(askzt)')] = 'zixun'
    d.to_sql('splited_gzdata', engine, index=False, if_exists='append')  # 保存
